<?php
/**
 * @copyright meila.com
 * @author wangtao5@
 * @name 保存图片分享
 * @param
 *         $this->pid = 图片的id;
 *
 */
include_once '../../__global.php';
include_once(SERVER_ROOT_PATH.'/include/config/ml_actionCode.php');
class aj_save_userShare extends ml_controller{
    private $pid;
    private $aid;
    private $arrAlert = array(
        'pid' => 'pid',
        'aid' => 'aid',
        'usid' => 'usid',
        );

    public function initParam()
    {
        $this->pid = (int)$this->input('pid','G');
        $this->aid = (int)$this->input('aid','G');
    }

    function checkParam(){
        $this->check_referer();
        if(empty($this->pid)) 
            $this->api_output(ML_RCODE_PARAM , '', $this->arrAlert['pid']);
        if(empty($this->aid))
            $this->api_output(ML_RCODE_PARAM , '', $this->arrAlert['aid']);
    }

    public function main()
    {
        $usid = $_COOKIE['usid'];
        if(empty($usid)) {
            $this->api_output(ML_RCODE_PARAM , '', $this->arrAlert['usid']);
        }

        Tool_logger::baseActionLog($usid , ML_ACTCODE_LB_PHOTO_SHARE , array($this->pid));
        if(true) {
            $oRdsAlbumCount = new ml_model_album_rdsCount();
            $oRdsAlbumCount->incrAlbumWeiboShareCnt($this->aid);
            $data = 1;
            $this->api_output(ML_RCODE_SUCC, $data);
        }else{
            $this->api_output(ML_RCODE_BUSY);
        }

    }
}
new aj_save_userShare();
?>